<template>
  <div class="xtx-bread-item">
    <template v-if="to">
      <router-link :to="to"><slot/></router-link>
    </template>
    <template v-else>
      <span><slot/></span>
    </template>
    <i v-if="joint">{{joint}}</i>
    <i v-else class="iconfont icon-angle-right"></i>
  </div>
</template>

<script>
import { inject } from 'vue'

export default {
  name: 'XtxBread',
  props: {
    to: {
      type: String,
      default: ''
    }
  },
  setup () {
    const joint = inject('joint')
    // console.log(123)
    return { joint }
  }
}
</script>

<style lang="less" scoped>
.xtx-bread-item {
  i {
    margin: 0 6px;
    font-size: 10px;
  }
  &:nth-last-of-type(1) {
    i {
      display: none;
    }
  }
}
</style>
